import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import 'router/router.dart';
import 'tools/tools.dart';

void main() {
  runApp(const MainApp());
}

class MainApp extends StatefulWidget {
  const MainApp({super.key});

  @override
  State<MainApp> createState() => _MainAppState();
}

class _MainAppState extends State<MainApp> {
  late Size sizeBox = const Size(750, 1334);

  platformType() {
    FPrint(Platform);
    if (Platform.isAndroid || Platform.isIOS) {
      sizeBox = const Size(750, 1334);
    } else {
      sizeBox = const Size(1920, 1080);
    }
  }

  init() {
    // Get.lazyPut(() => LayoutService());
  }

  @override
  void initState() {
    // platformType();
    init();
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
      designSize: sizeBox,
      minTextAdapt: true,
      splitScreenMode: true,
      builder: (_, child) => GetMaterialApp(
        initialRoute: "/",
        debugShowCheckedModeBanner: false,
        theme: themeConfig,
        getPages: AppPages.pages,
        builder: EasyLoading.init(),
      ),
    );
  }
}
